package com.orhon.smartcampus.modules.student.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import com.orhon.smartcampus.modules.base.entity.Grades;
import com.orhon.smartcampus.modules.base.entity.Periods;
import com.orhon.smartcampus.modules.base.entity.Schools;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "student_arrives", schema = "smartcloud", catalog = "")
public class Arrives {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;
    @Column(name = "name", nullable = true)
    private String name;
    @Column(name = "mark", nullable = true, length = 255)
    private String mark;
    @Column(name = "arrives_order", nullable = true)
    private Integer arrivesOrder;
    @Column(name = "begin_year", nullable = true, length = 191)
    private String beginYear;
    @Column(name = "graduate_year", nullable = true, length = 191)
    private String graduateYear;
    @Column(name = "garduate_status", nullable = true)
    private Integer garduateStatus;
    @Column(name = "created_at", nullable = true)
    private Date createdAt;
    @Column(name = "updated_at", nullable = true)
    private Date updatedAt;
    @Column(name = "deleted_at", nullable = true)
    private Date deletedAt;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "grade_id")
	@NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Grades baseGradesByGradeId;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "period_id")
	@NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Periods basePeriodsByPeriodId;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "school_id")
	@NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Schools baseSchoolsBySchoolId;
}
